#ifndef _PHY_DEBUG_H
#define _PHY_DEBUG_H (1)
/* 
 * PhyDebug.h
 * Created on Feb 24, 2004; 6:40 PM
 * by sriram
 */
/*
** Copyright 2004 by Hellosoft Inc. All rights reserved. No part
** of this publication, or any software included with it, may be
** reproduced, stored in a retrieval system, or transmitted in 
** any form or by any other means, including photocopying, 
** electronic or mechanical recording or otherwise, without
** prior written permission of the copyright holder
** 
** Hellosoft Confidential and Proprietary information 
**
**-------------------------------------------------------------
**/

#include <os/osapi.h>

#define  PHY_CYCLE_PRNT_FLAG       (0)
#define  PHY_TOTAL_CYCLE_PRNT_FLAG (0)
#define  PHY_RX_PRNT_PAR           (0)
//#define  PHY_RX_CYCLE_PRINT   (1)
//#define  RUN_ON_BOARD  (1)

#ifdef RUN_ON_BOARD
#define PRINT_XXX	printf
#else
#define PRINT_XXX	__putstring
#endif

volatile static int clock_begin;

#ifdef PHY_RX_CYCLE_PRINT
#define START_CLOCK {clock_begin = __sb_cfsr(MACH_CYC);}
#define PRINT_CYCLES(x) (PRINT_XXX("%s cycles = %d\n", x, __sb_cfsr(MACH_CYC) - clock_begin))
#else
#define START_CLOCK
#define PRINT_CYCLES(x)
#endif


#ifdef PHY_RX_CYCLE_PRINT_11
#define START_CLOCK_11 {clock_begin = __sb_cfsr(MACH_CYC);}
#define PRINT_CYCLES_11(x) (PRINT_XXX("%s cycles = %d\n", x, __sb_cfsr(MACH_CYC) - clock_begin))
#else
#define START_CLOCK_11
#define PRINT_CYCLES_11(x)
#endif

#ifdef PHY_RX_CYCLE_PRINT_55
#define START_CLOCK_55 {clock_begin = __sb_cfsr(MACH_CYC);}
#define PRINT_CYCLES_55(x) (PRINT_XXX("%s cycles = %d\n", x, __sb_cfsr(MACH_CYC) - clock_begin))
#else
#define START_CLOCK_55
#define PRINT_CYCLES_55(x)
#endif


#if PHY_CYCLE_PRNT_FLAG
   #define PHY_CYCLE_PRNT(x,y)   printf(x,y)
#else
   #define PHY_CYCLE_PRNT(x,y)
#endif

#if PHY_RX_PRNT_PAR
  #define PHY_DBG_PRINTF_PAR1(x,y)  printf(x,y)
#else
   #define PHY_DBG_PRINTF_PAR1(x,y)
#endif
#define PHY_DBG_PRINTF(x)
#endif   /* PHY_DEBUG_H */

